import request from '@/utils/request'

// 查询文档列表
export function listFilerecord(query) {
  return request({
    url: '/wlxz/filerecord/list',
    method: 'get',
    params: query
  })
}

// 查询文档详细
export function getFilerecord(id) {
  return request({
    url: '/wlxz/filerecord/' + id,
    method: 'get'
  })
}

// 新增文档
export function addFilerecord(categoryId, file) {
  const formData = new FormData();
  formData.append('cartegoryId', categoryId);
  formData.append('file', file);
  
  return request({
    url: '/wlxz/filerecord',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
}

// 修改文档
export function updateFilerecord(data) {
  return request({
    url: '/wlxz/filerecord',
    method: 'put',
    data: data
  })
}

// 删除文档
export function delFilerecord(id) {
  return request({
    url: '/wlxz/filerecord/' + id,
    method: 'delete'
  })
}
